import request from '@/utils/request'
import {
	formatePostParam
} from '@/utils'

const BASE_URL = ''

// 获取参数信息
export function getSystemSetInfo(query) {
	return request({
		url: `${BASE_URL}/SystemSetLst.asmx/getSystemSetInfo`,
		method: 'post',
		params: query
	})
}

export function updateSystemSetInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/SystemSetLst.asmx/updateSystemSetInfo`,
		method: 'post',
		data: query
	})
}

// 获取组织机构列表
export function getOrganizationList(query) {
	return request({
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/getOrganizationList`,
		method: 'post',
		params: query
	})
}

// 获取组织机构详情
export function getOrganizationInfo(query) {
	return request({
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/getOrganizationInfo`,
		method: 'post',
		params: query
	})
}

// 获取组织机构树
export function getDepartment(query) {
	return request({
		url: `${BASE_URL}/SystemDictionary.asmx/getDepartment`,
		method: 'post',
		params: query
	})
}

//新增组织机构
export function insertOrganizationInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/insertOrganizationInfo`,
		method: 'post',
		data: query
	})
}
//删除组织机构
export function deleteOrganizationInfo(query) {
	return request({
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/deleteOrganizationInfo`,
		method: 'post',
		params: query
	})
}
//修改组织机构
export function updateOrganizationInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/updateOrganizationInfo`,
		method: 'post',
		data: query
	})
}
// 获取角色列表
export function getRoleList(query) {
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/getRoleInfoList`,
		method: 'post',
		params: query
	})
}
// 获取选中角色列表
export function getSelectRoleList(query){
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/getRoleInfoList`,
		method: 'post',
		params: query
	}).then(res => res.data.roleList.map(item => ({value: item.id, label: item.roleName})))
}

// 新增角色配置
export function insertRoleInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/insertRoleInfo`,
		method: 'post',
		data: query
	})
}

// 修改角色配置
export function updateRoleInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/updateRoleInfo`,
		method: 'post',
		data: query
	})
}

// 删除角色配置
export function deleteRoleInfo(query) {
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/deleteRoleInfo`,
		method: 'post',
		params: query
	})
}

// 获取角色详情
export function getRoleInfo(query) {
	return request({
		url: `${BASE_URL}/PersonRoleLst.asmx/getRoleInfo`,
		method: 'post',
		params: query
	})
}

// 获取账号列表
export function getAccountList(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/getAccountList`,
		method: 'post',
		params: query
	})
}

// 获取账号详情
export function getAccountInfo(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/getAccountInfo`,
		method: 'post',
		params: query
	})
}
// 账号新增
export function insertAccountInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/PersonLst.asmx/insertAccountInfo`,
		method: 'post',
		data: query
	})
}
// 账号编辑
export function updateAccountInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/PersonLst.asmx/updateAccountInfo`,
		method: 'post',
		data: query
	})
}
// 账号删除
export function deleteAccountInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/PersonLst.asmx/deleteAccountInfo`,
		method: 'post',
		data: query
	})
}
// 校验重复性
export function checkUserName(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/checkUserName`,
		method: 'post',
		params: query
	})
}
// 所属企业
export function getEnterpriseInfos(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/getEnterpriseInfos`,
		method: 'post',
		params: query
	}).then(res => res.data)
}
// 人员类型
export function getPersonTypes(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/getPersonTypes`,
		method: 'post',
		params: query
	}).then(res => res.data)
}
// 角色信息
export function getPersonRoles(query) {
	return request({
		url: `${BASE_URL}/PersonLst.asmx/getPersonRoles`,
		method: 'post',
		params: query
	})
}

// 获取模板信息列表
export function getTemplateList(query) {
	return request({
		url: `${BASE_URL}/AlarmTemplateLst.asmx/getTemplateList`,
		method: 'post',
		params: query
	})
}
// 新增模板信息
export function InsertTemplate(query) {
	return request({
		url: `${BASE_URL}/AlarmTemplateLst.asmx/InsertTemplate`,
		method: 'post',
		params: query
	})
}
// 获取某一模板详情
export function getTemplate(query) {
	return request({
		url: `${BASE_URL}/AlarmTemplateLst.asmx/getTemplate`,
		method: 'post',
		params: query
	})
}
// 修改模板信息
export function UpdateTemplate(query) {
	return request({
		url: `${BASE_URL}/AlarmTemplateLst.asmx/UpdateTemplate`,
		method: 'post',
		params: query
	})
}
// 获取异常监测配置列表
export function getAbnormalSurveyList(query) {
	return request({
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/getAbnormalSurveyList`,
		method: 'post',
		params: query
	})
}
// 新增异常监测配置
export function InsertAlarmInfoSetInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/InsertAlarmInfoSetInfo`,
		method: 'post',
		data: query
	})
}
// 修改异常监测配置
export function UpdateAlarmInfoSetInfo(query) {
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/UpdateAlarmInfoSetInfo`,
		method: 'post',
		data: query
	})
}
// 获取异常监测配置详情
export function getAlarmInfoSetInfo(query) {
	return request({
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/getAlarmInfoSetInfo`,
		method: 'post',
		params: query
	})
}
// 获取报警因子
export function getMonitorObject(query) {
	return request({
		url: `${BASE_URL}/SystemDictionary.asmx/getMonitorObject`,
		method: 'post',
		params: query
	}).then(res => res.data)
}
// 获取报警类型
export function getAlarmType(query) {
	return request({
		url: `${BASE_URL}/SystemDictionary.asmx/getAlarmType`,
		method: 'post',
		params: query
	}).then(res => res.data)
}
// 获取异常通知配置列表
export function getAlarmNoticeLst(query) {
	return request({
		url: `${BASE_URL}/AlarmNoticeLst.asmx/getAlarmNoticeLst`,
		method: 'post',
		params: query
	})
}
// 获取通知人员
export function getAlarmNoticePerson(query){
	return request({
		url: `${BASE_URL}/AlarmNoticeLst.asmx/getAlarmNoticePerson`,
		method: 'post',
		params: query
	})

}

// 新增/编辑异常通知
export function insertAlarmNotice(query){
	query = formatePostParam(query)
	return request({
		url: `${BASE_URL}/AlarmNoticeLst.asmx/insertAlarmNotice`,
		method: 'post',
		data: query
	})
}

// 获取通知人员
export function getAlarmNotice(query){
	return request({
		url: `${BASE_URL}/AlarmNoticeLst.asmx/getAlarmNotice`,
		method: 'post',
		params: query
	})

}

// 删除通知信息
export function deleteAlarmNotice(query){
	return request({
		url: `${BASE_URL}/AlarmNoticeLst.asmx/deleteAlarmNotice`,
		method: 'post',
		params: query
	})

}

